﻿
CREATE PROCEDURE [dbo].[proc_Company_IsDelete]
	(
		@Id INT
	)
AS
	begin TRAN
--	declare @dwbh VARCHAR(10)	
--	 SET @dwbh=(SELECT dwbh FROM Company WHERE id=@Id)
     ----SET SELECT COUNT(*) AS bms ,(SELECT Company.CompanyName FROM Company WHERE Company.Id=@Id) AS cm 
     ----    FROM Department WHERE SUBSTRING(bmbh,1,2)=(SELECT dwbh FROM Company WHERE id=@Id)    
       SELECT COUNT(*) AS bms ,(SELECT Company.CompanyName FROM Company WHERE Company.Id=@Id) AS cm 
         FROM Department WHERE SUBSTRING(bmbh,1,2)=(SELECT cid FROM Company WHERE id=@Id)       
	commit tran
	RETURN